package com.clps.rulesregulations.util;

import java.util.ArrayList;
import java.util.List;

/**
 * 资源树
 *
 * @author 张超
 * @date 2017/7/12
 */
public class ResourceTree implements InheritedNode<ResourceTree> {
    private Integer id;
    private Integer oldId;
    private String name;
    private Integer parentId;
    private Integer topId;
    private String label;
    private String icon;
    private List<ResourceTree> children;
    //所在父目录全路径
    private String url;
    private Integer status;
    private Integer canDel;
    private Integer type;
    private Boolean disabled=false;
    private Boolean show=false;
    public ResourceTree() {}

    public ResourceTree(Integer id, String name) {
        this.id = id;
        this.name = name;
        this.parentId = parentId;
        this.label = name;
        this.url = url;
    }

    public ResourceTree(Integer id, String name, Integer parentId) {
        this.id = id;
        this.name = name;
        this.parentId = parentId;
        this.label = name;
        this.url = url;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<ResourceTree> getChildren() {
        return children;
    }

    public void setChildren(List<ResourceTree> children) {
        this.children = children;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    @Override
    public boolean isChildFrom(ResourceTree node) {
        return this.parentId.equals(node.getId());
    }

    @Override
    public boolean isBrother(ResourceTree node) {
        return this.parentId.equals(((ResourceTree)node).getParentId());
    }

    @Override
    public void addChildNode(ResourceTree node) {
        if(children == null) {
            children = new ArrayList<ResourceTree>();
        }
        children.add(node);
    }

    @Override
    public List<ResourceTree> getChildNodes() {
        return children;
    }

    public Boolean getDisabled() {
        return disabled;
    }

    public void setDisabled(Boolean disabled) {
        this.disabled = disabled;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getCanDel() {
        return canDel;
    }

    public void setCanDel(Integer canDel) {
        this.canDel = canDel;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getTopId() {
        return topId;
    }

    public void setTopId(Integer topId) {
        this.topId = topId;
    }

    public Integer getOldId() {
        return oldId;
    }

    public void setOldId(Integer oldId) {
        this.oldId = oldId;
    }

    public Boolean getShow() {
        return show;
    }

    public void setShow(Boolean show) {
        this.show = show;
    }
}
